﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Common.Extensions
{
    public static class BMPCompare
    {
        public static bool CompareTo(this Bitmap bmp, Bitmap obj)
        {
            Bitmap theObj = null;

            if (obj.GetType() == typeof(Bitmap)) theObj = obj as Bitmap;
            else if (obj.GetType().BaseType == typeof(Bitmap)) theObj = new Bitmap((Image)obj);
            else return false;

            return Convert.ToBase64String(bmp.AsBytes()).Equals(Convert.ToBase64String(theObj.AsBytes()));
        }
    }
}
